﻿using LuShanTea.Service.Entities;
using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LuShanTea.Service.ModelConfig
{
    public class OrderRecordConfig : EntityTypeConfiguration<OrderRecord>
    {
        public OrderRecordConfig()
        {
            this.ToTable("T_OrderRecords");

            HasRequired(o => o.Good).WithMany().HasForeignKey(o => o.GoodId).WillCascadeOnDelete(false);
            HasRequired(o => o.Pack).WithMany().HasForeignKey(o => o.PackId).WillCascadeOnDelete(false);
            HasRequired(o => o.Order).WithMany().HasForeignKey(o => o.OrderId).WillCascadeOnDelete(false);
            HasOptional(o => o.Comment).WithMany().HasForeignKey(o => o.CommentId).WillCascadeOnDelete(false);
        }
    }
}
